package com.sd365.permission.centre.api;

import com.sd365.permission.centre.pojo.dto.BlackOrWhiteDTO;
import com.sd365.permission.centre.pojo.query.BlackOrWhiteQuery;
import com.sd365.permission.centre.pojo.vo.BlackOrWhiteVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@CrossOrigin
@Api(tags = "黑白名单管理",value ="/permission/centre/v1/blackorwhite")
@RequestMapping(value = "/permission/centre/v1/blackorwhite")
public interface BlackOrWhiteApi {
    /**
     * 通用查询
     * @param blackOrWhiteQuery
     * @return
     */
    @ApiOperation(tags = "查询黑白名单，分页", value = "")
    @GetMapping("")
    @ResponseBody
    List<BlackOrWhiteVO> commonQuery(BlackOrWhiteQuery blackOrWhiteQuery);

    /**
     * @Title:
     * @Description: 批量更新
     * @Author: LiShiLong
     * @Date: 20:36 2020/12/15
     * @return:
     **/
    @ApiOperation(tags="批量更新",value="/batch")
    @PutMapping(value = "/batch")
    @ResponseBody
    Boolean batchUpdate(@RequestBody List<BlackOrWhiteDTO> blackOrWhiteDTOS);

    /**
     * @param: 黑白名单DTO
     * @return: 成功则true CommonResponse 应答码和消息统一参考基础框架
     * @see
     * @since
     */
    @ApiOperation(tags = "增加黑白名单信息", value = "/add")
    @PostMapping(value = "/add")
    @ResponseBody
    Boolean add(@RequestBody  BlackOrWhiteDTO blackOrWhiteDTO);

    /**
     * @param:
     * @return:
     * @see
     * @since
     */
    @ApiOperation(tags = "删除黑白名单信息", value = "/delete")
    @DeleteMapping(value = "/delete")
    @ResponseBody
    Boolean remove(@ApiParam(value = "当前行id", required = true) @RequestParam(value = "id", required = true) Long id,
                   @ApiParam(value = "当前行版本", required = true) @RequestParam(value = "version", required = true) Long version);


    /**
     * @param:
     * @return: 成功则true
     * @see
     * @since
     */
    @ApiOperation(tags="批量删除黑白名单信息",value="")
    @DeleteMapping(value="/batch")
    @ResponseBody
    Boolean batchDelete(@RequestBody @Valid BlackOrWhiteDTO[] blackOrWhiteDTOS);

    /**
     * @return java.lang.Boolean
     * @Description 修改黑白名单信息
     * @Param * @param blackOrWhiteDTO
     **/
    @ApiOperation(tags = "修改黑白名单信息", value = "/modify")
    @PutMapping(value = "/modify")
    @ResponseBody
    Boolean modify(@Valid @RequestBody BlackOrWhiteDTO blackOrWhiteDTO);

    @ApiOperation(tags = "通过id查询", value = "")
    @GetMapping(value = "{id}")
    @ResponseBody
    BlackOrWhiteVO queryById(@PathVariable("id") Long id);

    /**
     * 批量插入
     *
     * @param
     * @return
     */
    @PostMapping(value = "/batchadd")
    Boolean batchAdd(@RequestBody List<BlackOrWhiteDTO> blackOrWhiteDTOList);


    @GetMapping(value = "/test")
    public BlackOrWhiteVO testRedis(BlackOrWhiteQuery blackOrWhiteQuery);
}
